#! /bin/sh

rm -f TAGS

if git rev-parse HEAD >/dev/null 2>&1
then
  cd `git rev-parse --show-toplevel`
  echo sql mysys strings client storage dbug libmysql sql-common \
       extra mysys_ssl strings regex pcre vio include \
       tools unittest plugin libmysqld | \
       xargs -n1 git ls-files | grep -v '\.jar$' | grep -v '\.xz$' | \
       xargs etags -o TAGS --append
else
  find . -type f ! -name "*.jar" |
       xargs etags -o TAGS --append
fi
